class UtilitySetting < ActiveRecord::Base

  def self.is_peak
  	t = UtilityFunctions.current_time[0]
  	s = UtilitySetting.last
  	if  t > s.peak_start.hour and t < s.peak_end.hour
  		return true
  	else
  		return false
  	end
  end 
  
  def self.get_price
    if  is_peak
    	price = UtilitySetting.last.peak_price.to_f
    else
    	price = UtilitySetting.last.off_peak_price.to_f
    end
    return price
  end
end
